package com.tao.YanMoDesignPattern.Mediator.case1_mainbox;

/**
 * @Author Mi_Tao
 * @Date 2023/7/23
 * @Description
 * @Version 1.0
 **/
public class Client {
    public static void main(String[] args) {

        //  1 创建中介者 -- 主板对象
        MainBoard mediator = new MainBoard();
        // 2 创建同事类
        CDDriver cdDriver = new CDDriver(mediator);
        CPU cpu = new CPU(mediator);
        SoundCard soundCard = new SoundCard(mediator);
        ViedoCard viedoCard = new ViedoCard(mediator);

        // 3 让中介者知道所有的同事
        mediator.setCpu(cpu);
        mediator.setCdDriver(cdDriver);
        mediator.setSoundCard(soundCard);
        mediator.setViedoCard(viedoCard);

        // 4 开始看电影 把光盘放入光驱，光驱开始读盘
        cdDriver.readCD();
    }
}
